package com.jiruan.invoicemanagementsystem.controller;


import com.google.gson.Gson;
import com.jiruan.invoicemanagementsystem.pojo.User;
import com.jiruan.invoicemanagementsystem.service.IUserService;
import com.jiruan.invoicemanagementsystem.service.imp.IUserServiceImp;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

//登录页面
@WebServlet("/user/*")
public class LoginController extends BaseController {
    IUserService ius=new IUserServiceImp();

    //登陆方法
    public void login(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String username=request.getParameter("account");
        String password=request.getParameter("password");

       boolean b = ius.Login(username,password);
        if (b) {
            response.getWriter().println(new Gson().toJson(b));
        }else {
            response.getWriter().println(new Gson().toJson(b));
        }
    }

}
